package com.rc.saas.tenant.mapper.elec;

import com.rc.saas.tenant.common.base.BaseMapper;
import com.rc.saas.tenant.model.elec.ElecPile;
import com.rc.saas.tenant.model.elec.ElecPileExample;
import com.rc.saas.tenant.model.elec.ElecStation;
import com.rc.saas.tenant.search.StatisticsSearch;
import com.rc.saas.tenant.search.elec.ElecPileSearch;
import com.rc.saas.tenant.search.elec.PileOfflineSearch;
import com.rc.saas.tenant.search.hlht.HlhtTenantOpenPileSearch;
import com.rc.saas.tenant.vo.elec.*;
import com.rc.saas.tenant.vo.hlht.HlhtTenantOpenPileVo;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

public interface ElecPileMapper extends BaseMapper<Long ,ElecPile, ElecPileExample> {
    List<ElecPileResultVo> listByCondition(ElecPileSearch elecPileSearchVo);

    ElecPile selectLastPileNo(@Param("tenantCode") String tenantCode,@Param("elecStationId") Long elecStationId);

    int selectGunByStation(Long elecStationId);

    ElecPileStatusCountVo countByPileStatus(@Param("tenantCode") String tenantCode, @Param("elecStationId") Long elecStationId,@Param("bizType") String bizType);

    ElecPileStatusCountVo countByPileStatusOperator(@Param("eleStationIds") List<Long> eleStationIds, @Param("elecStationId") Long elecStationId);

    long countPile(@Param("tenantCode")String tenantCode, @Param("pileType")String pileType);

    void insertSelectiveReturnId(ElecPile elecPile);

    void updateBatchElecPileOperateStatusByElecStationIdList(@Param("elecStationIdList") List<Long> elecStationIdList, @Param("operateStatus") String operateStatus,@Param("status") Integer status);

    List<ElecPile> listPageElecPile(ElecPileSearch elecPileSearch);

    List<ElecPile> listElecPileByStationIdList(@Param("elecStationIdList") List<Long> elecStationIdList);

    List<HlhtTenantOpenPileVo> listPageHlhtTenantOpenPile(HlhtTenantOpenPileSearch hlhtTenantOpenPileSearch);

    List<ElecPile> listElecPileByElecPileIdList(@Param("elecPileIdList") List<Long> elecPileIdList);

    List<PileOfflineVo> listPagePileOffline(PileOfflineSearch pileOfflineSearch);

    PileOfflineVo selectPileOfflineInfo(@Param("elecPileId") Long elecPileId, @Param("beginTime") Date beginTime, @Param("endTime") Date endTime);

    PileOffineStatisticsVo selectPileOffineStatistics(String tenantCode);

    /**
     * 直流桩数量
     *
     * @param elecStationId
     * @return
     */
    Integer countDirectCurrentPile(Long elecStationId);

    /**
     * 交流桩数量
     *
     * @param elecStationId
     * @return
     */
    Integer countExchangePile(Long elecStationId);

    /**
     * 总功率
     *
     * @param elecStationId
     * @return
     */
    Integer sumPileTotalPower(Long elecStationId);

    /**
     * 主页控制台桩统计
     * @param search
     * @return
     */
    StationAllDataVo countPileInConsole(StatisticsSearch search);

    void updateOperatorBySId(ElecStation elecStation);
}
